package io.github.lee.app.unsplash.repository

import io.github.lee.app.unsplash.repository.api.TopicApi
import io.github.lee.app.unsplash.repository.domain.Photo
import io.github.lee.app.unsplash.repository.domain.Topic
import io.github.lee.app.unsplash.repository.domain.UnsplashResponse
import io.github.lee.app.unsplash.repository.params.OrderBy
import io.github.lee.app.unsplash.repository.params.Orientation
import javax.inject.Inject

class TopicRepository @Inject constructor(
    private val api: TopicApi
) {
    suspend fun topicList(
        page: Int = 1, size: Int = 10,
        orderBy: OrderBy? = OrderBy.Position,
    ): UnsplashResponse<List<Topic>> =
        api.topicList(page, size, orderBy?.value)

    suspend fun topicPhotoList(
        topicId: String,
        page: Int,
        size: Int,
        orientation: Orientation? = null,
        orderBy: OrderBy? = OrderBy.Latest
    ): UnsplashResponse<List<Photo>> =
        api.topicPhotoList(topicId, page, size, orientation?.value, orderBy?.value)
}